//    Copyright (C) Kherty.  All rights reserved.
namespace OpenLS.Spreadsheet.Extensibility
{
    public class AllowDoubleToBooleanConversionAttribute : ParameterConverterAttribute
    {
        internal override void ConvertImp(ConversionData data)
        {
            if (data.TargetType == typeof(bool))
            {
                if (data.Value is double)
                {
                    double dbl = (double)data.Value;
                    if (dbl == 1)
                        data.Result = true;
                    if (dbl == 0)
                        data.Result = false;
                }
            }
        }
    }
}